<template>
  <div class="admin-log-container">
    <el-table
      :data="tableData"
      border
      style="width: 100%"
      header-align="center"
    >
      <el-table-column
        prop="adminId"
        label="管理员ID"
        width="180"
        align="center"
      />
      <el-table-column
        prop="logText"
        label="日志内容"
        min-width="300"
        align="left"
      />
      <el-table-column
        prop="time"
        label="时间"
        width="200"
        align="center"
      />
    </el-table>
  </div>
</template>

<script setup>
import { ref, onMounted } from 'vue'
import {getAdminLogList} from '@/api/Adminlog'

const tableData = ref([])

// 获取日志数据
const fetchLogs =  () => {
  getAdminLogList().then(res => {
    
    if (res.data.code === 200) {
      tableData.value = res.data.data
    }else{
      ElMessage.error(res.data.msg)
    }
  })
 
}

onMounted(() => {
  fetchLogs()
})
</script>

<style scoped>
.admin-log-container {
  padding: 20px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
}

.el-table {
  margin-top: 15px;
}
</style>